<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


<%@ page import="org.springframework.context.ApplicationContext, dk.ihk.shopular.services.UserService, org.springframework.web.servlet.support.RequestContextUtils" %> 
<%
	ApplicationContext context = RequestContextUtils.getWebApplicationContext(request);
	UserService userService = (UserService) context.getBean("userService");
	if (userService.validAuthentication(request)) {
		String redirectURL = "/shopular/dashboard.do";
	    response.sendRedirect(redirectURL);
	} 
%>

<html>
	<head>
		<style type="text/css">
		  body {
		    border: 10px solid #000000;
		    padding:5px;
		  	background-color: #ffffff;
		  	color: #000000;
		  	font-size:1.5em;
		  }
		  .header {
		  	font-size:0.8em;
		  }
		</style>
		<title>shopular.</title>
	</head>
	<body>
		<h1>shopular.</h1>
		<h3>Your credentials, please!</h3>
		<form method="post" action="/shopular/user/verifyLogin.do">
			<table border="0">
				<tr><td>Your name</td><td><input type="text" name="username"/></td></tr> 
				<tr><td>Your password</td><td><input type="password" name="password"/></td></tr> 
				<tr><td></td><td><input type="submit"/></td></tr>
		</form>
	</body>
</html>